﻿@{
    ViewBag.Title = "日志管理";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<style type="text/css">
    .layout-split-west {
        border-right-color: Window;
    }
</style>

<div class="easyui-layout" data-options="fit:true" scroll="no">
    <div data-options="region:'center',noheader:true,border:false">
        <table id="dgLog"></table>
    </div>
</div>
<div id="tbar">
    <div class="tbar">
        <table>
            <tr>
                <td class="td-right">日期:</td>
                <td class="td-left"><input name="txtStartDate" class="easyui-datebox" />—<input name="txtEndDate" class="easyui-datebox" /></td>
                <td class="td-right"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="btnSearch_OnClick()">查询</a></td>
            </tr>
        </table>
    </div>
</div>
@section PageSpecificScript{
    <script type="text/javascript">
        var dgLog;/*显示用户*/
        $(document).ready(function () {
            $.validateUrl("/Admin/Sys_LoginLog/GetLogList", function () {
                dgLog = $("#dgLog").datagrid({
                    url: '/Admin/Sys_LoginLog/GetLogList',
                    method: 'get',
                    idField: 'LogID',
                    fit: true,
                    fitColumns: true,
                    rownumbers: true,
                    striped: true,
                    pagination: true,
                    singleSelect: true,
                    toolbar: '#tbar',
                    pageSize: 20,
                    pageList: [10, 20, 30, 40, 50],
                    frozenColumns: [[
                        { field: 'LogID', title: 'LogID', hidden: true }
                    ]],
                    columns: [[
                        { field: 'LoginName', title: '登录名', width: 100, halign: 'center', align: 'center' },
                        { field: 'LoginState', title: '状态', width: 120, halign: 'center', align: 'center', formatter: function (value) { if (value == 1) return '登录成功'; else return '登录失败' } },
                        { field: 'LoginIP', title: '登录IP', width: 120, halign: 'center' },
                        { field: 'IPAddress', title: '登录地点', width: 150, halign: 'center', hidden: true },
                        {
                            field: 'LoginTime', title: '登录时间', width: 200, halign: 'center', align: 'center',
                            formatter: function (value) {
                                if (value) {
                                    return eval("new " + value.substr(1, value.length - 2)).toLocaleDateString();
                                }
                            }
                        }

                    ]],
                    onDblClickRow: function (rowIndex, rowData) {
                        if (editRow != undefined) {
                            dgLog.datagrid('endEdit', editRow);
                        } else {
                            dgLog.datagrid('beginEdit', rowIndex);
                            editUser = rowIndex;
                            dgLog.datagrid('selectRow', editUser);
                        }
                    },
                    onRowContextMenu: function (e, rowIndex, rowData) {
                        e.preventDefault();
                        $(this).datagrid("unselectAll");
                        $(this).datagrid("selectRow", rowIndex);
                        $("#menu").menu('show', {
                            left: e.pageX,
                            top: e.pageY
                        });
                    }
                });
            });
        }, xz.dealWith, 'GET');
    </script>
}
